<template>
  <div style="padding: 10px 15px">
    <!-- 查询条件-->
    <div class="filter-container">
      <el-input
        v-model="listQuery.title"
        placeholder="请输入单号"
        style="width: 200px"
        class="filter-item"
        @keyup.enter.native="handleFilter"
      />
      <el-col :span="3" style="margin-right: 10px">
        <el-date-picker
          v-model="form.StDt"
          type="date"
          placeholder="请选择开始日期"
          style="width: 100%; margin-right: 10px"
          format="yyyy-MM-dd"
          class="filter-item"
        />
      </el-col>
      <el-col :span="3" style="margin-right: 10px">
        <el-date-picker
          v-model="form.EdDt"
          type="date"
          placeholder="请选择结束日期"
          style="width: 100%; margin-right: 10px"
          format="yyyy-MM-dd"
          class="filter-item"
        />
      </el-col>
      <el-button
        class="filter-item seachbttn"
        type="primary"
        icon="el-icon-search"
        @click="handleFilter"
      >查询</el-button>
    </div>
    <div class="filter_fenge" style="border:none;border-top:1px solid #d1ddeb" />
    <div class="filter-container">
      <el-button
        class="filter-item"
        type="primary"
        icon="el-icon-upload"
        @click="openExportdialog()"
      >导入</el-button>
    </div>
    <!--查询条件 end-->

    <!--table-->
    <el-table
      v-loading="listLoading"
      :data="PayRecordHelpData"
      fit
      highlight-current-row
      style="width: 100%"
      stripe
    >
      <el-table-column
        v-if="this.logincpnid == sy"
        label="企业名称"
        align="left"
        min-width="150px"
      >
        <template slot-scope="{ row }">
          <span>{{ row.cpnid }}</span>
        </template>
      </el-table-column>
      <el-table-column label="门店编号" align="left" min-width="150px">
        <template slot-scope="{ row }">
          <span>{{ row.orgid }}</span>
        </template>
      </el-table-column>
      <el-table-column label="收银机号" align="left" min-width="150px">
        <template slot-scope="{ row }">
          <span>{{ row.recdevice }}</span>
        </template>
      </el-table-column>
      <el-table-column label="收银员" align="left" min-width="150px">
        <template slot-scope="{ row }">
          <span>{{ row.recman }}</span>
        </template>
      </el-table-column>
      <el-table-column label="商户订单号" align="left" min-width="350px">
        <template slot-scope="{ row }">
          <span>{{ row.payid }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="第三方平台订单号"
        align="left"
        min-width="350px"
      >
        <template slot-scope="{ row }">
          <span>{{ row.transid }}</span>
        </template>
      </el-table-column>
      <el-table-column label="支付完成时间" align="left" min-width="160px">
        <template slot-scope="{ row }">
          <span>{{ row.resdt }}</span>
        </template>
      </el-table-column>
      <el-table-column label="支付方式" align="left" min-width="150px">
        <template slot-scope="{ row }">
          <span>{{ row.paytyp }}</span>
        </template>
      </el-table-column>
      <el-table-column label="支付通道" align="left" min-width="200px">
        <template slot-scope="{ row }">
          <span>{{ row.paychannel }}</span>
        </template>
      </el-table-column>
      <el-table-column label="交易状态" align="left" min-width="90px">
        <template slot-scope="{ row }">
          <span
            :class="[
              row.stt == 1 || row.stt == 2 || row.stt == 3 || row.stt == 5
                ? 'green'
                : 'red',
            ]"
          >{{ row.sttstr }}</span>
        </template>
      </el-table-column>
      <el-table-column label="交易类型" align="left" min-width="90px">
        <template slot-scope="{ row }">
          <span>{{ row.typ }}</span>
        </template>
      </el-table-column>
      <el-table-column label="收款账户" align="left" min-width="230px">
        <template slot-scope="{ row }">
          <span>{{ row.pid }}</span>
        </template>
      </el-table-column>

      <el-table-column label="订单金额/元" align="right" min-width="150px">
        <template slot-scope="{ row }">
          <span>{{ row.price }}</span>
        </template>
      </el-table-column>
      <el-table-column label="退款金额/元" align="right" min-width="150px">
        <template slot-scope="{ row }">
          <span>{{ row.rfundamt }}</span>
        </template>
      </el-table-column>
      <el-table-column label="撤销金额/元" align="right" min-width="150px">
        <template slot-scope="{ row }">
          <span>{{ row.cancelmoney }}</span>
        </template>
      </el-table-column>
      <el-table-column label="退款单号" align="left" min-width="350px">
        <template slot-scope="{ row }">
          <span>{{ row.rfundid }}</span>
        </template>
      </el-table-column>
      <el-table-column label="撤销单号" align="left" min-width="150px">
        <template slot-scope="{ row }">
          <span>{{ row.rvokid }}</span>
        </template>
      </el-table-column>
      <el-table-column label="交易备注" align="left" min-width="350px">
        <template slot-scope="{ row }">
          <span>{{ row.msg }}</span>
        </template>
      </el-table-column>
      <!--
        <el-table-column fixed="right" label="操作" width="100">
        <template slot-scope="scope">
          <el-button
            @click="handleClick(scope.row)"
            v-if="Jurisdiction('编辑')"
            type="primary"
            size="mini"
          >编辑</el-button>
          <el-button @click="handleClick(scope.row)" type="primary" size="mini">查看</el-button>
          <el-button
            class="filter-item"
            type="danger"
            icon="el-icon-delete"
            v-if="Jurisdiction('删除')"
            @click="deleteClick()"
          >删除</el-button>
        </template>
      </el-table-column>
      -->
    </el-table>

    <pagination
      v-show="listQuery.total > 0"
      :total="listQuery.total"
      :page.sync="listQuery.page"
      :limit.sync="listQuery.limit"
      @pagination="fetchData(this)"
    />

    <!--table end -->

    <!--弹出层  新增-->
    <el-dialog
      :title="textMap[dialogStatus]"
      :visible.sync="dialogFormVisible"
      width="55%"
    >
      <el-form :model="form" :inline="true" label-position="right" />
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="saveForm">确 定</el-button>
      </div>
    </el-dialog>

    <!--详情-->
    <el-dialog title="详情" :visible.sync="dialogdetailsVisible" width="55%">
      <el-form
        :model="details_form"
        :inline="true"
        label-position="right"
      />
    </el-dialog>
    <!--导入三方订单-->
    <el-dialog
      title="导入三方订单"
      :visible.sync="dialogExportVisible"
      width="55%"
    >
      <div v-loading="exportloading" class="exportotherpaydiv">
        <el-form :model="export_form" :inline="true" label-position="right">
          <el-form-item label="企业号"
           prop="cpnID"
              :rules="[
                { required: true, message: '企业号不能为空', trigger: 'change' },
              ]"
          >
            <el-select
              v-model="export_form.cpnID"
              filterable
              clearable
              class="filter-item"
              placeholder="请选择企业"
              style="width: 80%"
              @change="selectpaychannel()"
            >
              <el-option
                v-for="item in cpnoptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="支付通道"
            prop="paychannel"
              :rules="[
                { required: true, message: '支付通道不能为空', trigger: 'change' },
              ]"
          >
            <el-select
              v-model="export_form.paychannel"
              clearable
              filterable
              class="filter-item"
              placeholder="请选择支付通道"
              style="width: 80%"
              @change="selectact()"
            >
              <el-option
                v-for="item in paytychanneloptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <br>
          <el-form-item label="账户"
            prop="act"
              :rules="[
                { required: true, message: '账户不能为空', trigger: 'blur' },
              ]"
          >
            <el-select
              v-model="export_form.act"
              clearable
              filterable
              class="filter-item"
              placeholder="请选择账户"
              style="width: 80%"
            >
              <el-option
                v-for="item in actlist"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="请选择日期"
           prop="dt"
              :rules="[
                { required: true, message: '日期不能为空', trigger: 'blur' },
              ]"
          >
            <el-date-picker
              v-model="export_form.dt"
              style="width: 80%"
              type="date"
              placeholder="请选择日期"
              format="yyyy-MM-dd"
            />
          </el-form-item>

          <div style="width: 55%; text-align: left; padding-left: 10%;">
            <el-upload
              ref="upload"
              class="upload-otherpay"
              action=""
              :on-preview="handlePreview"
              :on-remove="handleRemove"
              :before-remove="beforeRemove"
              accept=".csv,.xls,.xlsx"
              :before-upload="beforeUpload"
              multiple
              :limit="1"
              :on-exceed="handleExceed"
              :file-list="fileList"
              :auto-upload="false"
            >
              <el-button
                type="primary"
                icon="el-icon-circle-plus-outline"
                plain
              >添加三方订单文件</el-button>
              <div slot="tip" class="el-upload_tip" style="width:65%">
                只能上传.xls/.xlsx/.csv文件
              </div>
            </el-upload>
          </div>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="primary" @click="submitUpload()">确 定</el-button>
        </div>
      </div>
    </el-dialog>
    <!--弹出层 end-->
  </div>
</template>

<script>
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
import { AjaxToken, TipConfirm, AjaxUpload } from '@/api/common'
import { SelectAjax } from '@/api/common'
import { Jurisdiction } from '@/api/common'
import sessionStorage from '@/api/Storage'
import 'url-search-params-polyfill'
export default {
  name: 'OthPay',
  components: { Pagination },
  data() {
    return {
      sy: 'system',
      logincpnid: '',
      exportloading: false,
      multipleSelection: [],
      fileList: [],
      cpnoptions: [],
      paytychanneloptions: [],
      actlist: [],
      formLabelWidth: '120px',
      PayRecordHelpData: null,
      listQuery: {
        title: '',
        total: 0,
        page: 1,
        limit: 10
      },
      listLoading: true,
      dialogExportVisible: false,
      dialogFormVisible: false,
      dialogdetailsVisible: false,
      dialogStatus: '',
      textMap: {
        update: '修改',
        create: '添加'
      },
      form: {
        编号: '',
        cpnID: '',
        eRPCpnId: '',
        orgID: '',
        h: '',
        recDevice: '',
        recMan: '',
        payID: '',
        transID: '',
        payTyp: '',
        payChannel: '',
        stt: '',
        typ: '',
        auth_type: '',
        pID: '',
        uID: '',
        price: '',
        disc: '',
        derAmt: '',
        amt: '',
        cpnAmt: '',
        othAmt: '',
        wuAmt: '',
        rfundID: '',
        rfundAmt: '',
        rvokID: '',
        cancelMoney: '',
        resDt: '',
        resTimes: '',
        isLkdrw: '',
        bllNo: '',
        rdx: '',
        msg: '',
        actCfg: '',
        godsInfo: '',
        authTyp: '',
        area: '',
        authCode: '',
        localPort: '',
        iP: '',
        mac: '',
        dt: '',
        StDt: '',
        EdDt: ''
      },
      details_form: {
        编号: '',
        cpnID: '',
        eRPCpnId: '',
        orgID: '',
        h: '',
        recDevice: '',
        recMan: '',
        payID: '',
        transID: '',
        payTyp: '',
        payChannel: '',
        stt: '',
        typ: '',
        auth_type: '',
        pID: '',
        uID: '',
        price: '',
        disc: '',
        derAmt: '',
        amt: '',
        cpnAmt: '',
        othAmt: '',
        wuAmt: '',
        rfundID: '',
        rfundAmt: '',
        rvokID: '',
        cancelMoney: '',
        resDt: '',
        resTimes: '',
        isLkdrw: '',
        bllNo: '',
        rdx: '',
        msg: '',
        actCfg: '',
        godsInfo: '',
        authTyp: '',
        area: '',
        authCode: '',
        localPort: '',
        iP: '',
        mac: '',
        dt: ''
      },
      export_form: {
        cpnID: '',
        act: '',
        paychannel: '',
        dt: ''
      }
    }
  },
  // 初始化
  created() {
    var userinfo = JSON.parse(sessionStorage.getItem('userinfo'))
    this.logincpnid = userinfo.cpnId
    this.fetchData()
  },
  mounted() {
    backstage.GeCpntListItems(this)
  },
  methods: {
    submitUpload() {
      var that = this
       if(this.export_form.cpnID==""){
         this.$message({
            type: 'error',
            duration: 1000,
            message: '请选择企业!'
          })
          return
      }
       if(this.export_form.paychannel==""){
         this.$message({
            type: 'error',
            duration: 1000,
            message: '请选择支付通道!'
          })
          return
      }
       if(this.export_form.act==""){
         this.$message({
            type: 'error',
            duration: 1000,
            message: '请选择账户!'
          })
          return
      }

      if(this.export_form.dt==""){
           this.$message({
            type: 'error',
            duration: 1000,
            message: '请选择日期!'
          })
          return   
      }
      setTimeout(function() {
        if (that.$refs.upload.$children[0].fileList.length == 1) {
          that.$refs.upload.submit()
        } else {
          that.$message({
            type: 'error',
            showClose: true,
            duration: 3000,
            message: '请选择文件!'
          })
        }
      }, 100)
    },
    beforeUpload(file) {
      var that = this
      that.$refs.upload.clearFiles()
      // 文件类型
      var fileName = file.name.substring(file.name.lastIndexOf('.') + 1)
      if (fileName != 'xls' && fileName != 'xlsx' && fileName != 'csv') {
        that.$message({
          type: 'error',
          showClose: true,
          duration: 3000,
          message: '文件类型不是.xls/.xlsx/.csv文件!'
        })
        return false
      }
      if (this.export_form.cpnID == '') {
        that.$message({
          type: 'error',
          showClose: true,
          duration: 3000,
          message: '请选择企业'
        })
        return false
      }
      if (this.export_form.paychannel == '') {
        that.$message({
          type: 'error',
          showClose: true,
          duration: 3000,
          message: '请选择支付通道'
        })
        return false
      }
      if (this.export_form.act == '') {
        that.$message({
          type: 'error',
          showClose: true,
          duration: 3000,
          message: '请选择账户'
        })
        return false
      }
      if (this.export_form.dt == '') {
        that.$message({
          type: 'error',
          showClose: true,
          duration: 3000,
          message: '请选择日期'
        })
        return false
      }
      // 读取文件大小
      // var fileSize = file.size;
      // console.log(fileSize);
      // if (fileSize > 1048576) {
      //   that.exportloading = false;
      //   that.$message({
      //     type: "error",
      //     showClose: true,
      //     duration: 3000,
      //     message: "文件大于1M!",
      //   });
      //   return false;
      // }
      const params = new FormData()
      params.append('file', file)
      params.append('cpnID', this.export_form.cpnID)
      params.append('act', this.export_form.act)
      params.append('paychannel', this.export_form.paychannel)
      params.append('dt', new Date(this.export_form.dt).toLocaleDateString())
      params.append('_t1', new Date())
      that.exportloading = true
      backstage.beforeUpload(that, params)
    },
    openExportdialog() {
      this.dialogExportVisible = true
      var that = this
      setTimeout(function() {
        that.$refs.upload.clearFiles()
      }, 100)
    },
    selectpaychannel() {
      this.export_form.paychannel = ''
      this.export_form.act = ''
      this.actlist = []
      this.paytychanneloptions = []
      backstage.GetPyChannelSelectListItems(this, this.export_form.cpnID)
    },
    selectact() {
      this.export_form.act = ''
      this.actlist = []
      backstage.GetCpnActListSelectListItems(
        this,
        this.export_form.cpnID,
        this.export_form.paychannel
      )
    },
    handleRemove(file, fileList) {
      console.log(file, fileList)
    },
    handlePreview(file) {
      console.log(file)
    },
    handleExceed(files, fileList) {},
    beforeRemove(file, fileList) {
      // return this.$confirm(`确定移除 ${file.name}？`);
    },

    // 权限
    Jurisdiction(moduleActionName) {
      return Jurisdiction(moduleActionName, this)
    },
    // 多选
    handleSelectionChange(val) {
      this.multipleSelection = val
    },
    // 多选赋值
    toggleSelection(rows) {
      if (rows) {
        rows.forEach((row) => {
          this.$refs.multipleTable.toggleRowSelection(row)
        })
      } else {
        this.$refs.multipleTable.clearSelection()
      }
    },
    // 搜索
    handleFilter() {
      this.listQuery.page = 1
      this.fetchData()
    },
    // 新增
    handleCreate() {
      this.dialogStatus = 'create'
      this.dialogFormVisible = true
      this.form = {
        cpnID: '',
        eRPCpnId: '',
        orgID: '',
        h: '',
        recDevice: '',
        recMan: '',
        payID: '',
        transID: '',
        payTyp: '',
        payChannel: '',
        stt: '',
        typ: '',
        auth_type: '',
        pID: '',
        uID: '',
        price: '',
        disc: '',
        derAmt: '',
        amt: '',
        cpnAmt: '',
        othAmt: '',
        wuAmt: '',
        rfundID: '',
        rfundAmt: '',
        rvokID: '',
        cancelMoney: '',
        resDt: '',
        resTimes: '',
        isLkdrw: '',
        bllNo: '',
        rdx: '',
        msg: '',
        actCfg: '',
        godsInfo: '',
        authTyp: '',
        area: '',
        authCode: '',
        localPort: '',
        iP: '',
        mac: '',
        dt: ''
      }
    },
    // 编辑
    handleClick(row) {
      this.form.编号 = row.编号
      this.form.cpnID = row.cpnID
      this.form.eRPCpnId = row.eRPCpnId
      this.form.orgID = row.orgID
      this.form.h = row.h
      this.form.recDevice = row.recDevice
      this.form.recMan = row.recMan
      this.form.payID = row.payID
      this.form.transID = row.transID
      this.form.payTyp = row.payTyp
      this.form.payChannel = row.payChannel
      this.form.stt = row.stt
      this.form.typ = row.typ
      this.form.auth_type = row.auth_type
      this.form.pID = row.pID
      this.form.uID = row.uID
      this.form.price = row.price
      this.form.disc = row.disc
      this.form.derAmt = row.derAmt
      this.form.amt = row.amt
      this.form.cpnAmt = row.cpnAmt
      this.form.othAmt = row.othAmt
      this.form.wuAmt = row.wuAmt
      this.form.rfundID = row.rfundID
      this.form.rfundAmt = row.rfundAmt
      this.form.rvokID = row.rvokID
      this.form.cancelMoney = row.cancelMoney
      this.form.resDt = row.resDt
      this.form.resTimes = row.resTimes
      this.form.isLkdrw = row.isLkdrw
      this.form.bllNo = row.bllNo
      this.form.rdx = row.rdx
      this.form.msg = row.msg
      this.form.actCfg = row.actCfg
      this.form.godsInfo = row.godsInfo
      this.form.authTyp = row.authTyp
      this.form.area = row.area
      this.form.authCode = row.authCode
      this.form.localPort = row.localPort
      this.form.iP = row.iP
      this.form.mac = row.mac
      this.form.dt = row.dt
      this.dialogStatus = 'edit'
      this.dialogFormVisible = true
    },
    // 保存
    saveForm() {
      var arr = this.multipleSelection
      var params = new URLSearchParams()
      params.append('编号', this.form.编号)
      params.append('CpnID', this.form.cpnID)
      params.append('ERPCpnId', this.form.eRPCpnId)
      params.append('OrgID', this.form.orgID)
      params.append('H', this.form.h)
      params.append('RecDevice', this.form.recDevice)
      params.append('RecMan', this.form.recMan)
      params.append('PayID', this.form.payID)
      params.append('TransID', this.form.transID)
      params.append('PayTyp', this.form.payTyp)
      params.append('PayChannel', this.form.payChannel)
      params.append('Stt', this.form.stt)
      params.append('Typ', this.form.typ)
      params.append('Auth_type', this.form.auth_type)
      params.append('PID', this.form.pID)
      params.append('UID', this.form.uID)
      params.append('Price', this.form.price)
      params.append('Disc', this.form.disc)
      params.append('DerAmt', this.form.derAmt)
      params.append('Amt', this.form.amt)
      params.append('CpnAmt', this.form.cpnAmt)
      params.append('OthAmt', this.form.othAmt)
      params.append('WuAmt', this.form.wuAmt)
      params.append('RfundID', this.form.rfundID)
      params.append('RfundAmt', this.form.rfundAmt)
      params.append('RvokID', this.form.rvokID)
      params.append('CancelMoney', this.form.cancelMoney)
      params.append('ResDt', this.form.resDt)
      params.append('ResTimes', this.form.resTimes)
      params.append('IsLkdrw', this.form.isLkdrw)
      params.append('BllNo', this.form.bllNo)
      params.append('Rdx', this.form.rdx)
      params.append('Msg', this.form.msg)
      params.append('ActCfg', this.form.actCfg)
      params.append('GodsInfo', this.form.godsInfo)
      params.append('AuthTyp', this.form.authTyp)
      params.append('Area', this.form.area)
      params.append('AuthCode', this.form.authCode)
      params.append('LocalPort', this.form.localPort)
      params.append('IP', this.form.iP)
      params.append('Mac', this.form.mac)
      params.append('Dt', this.form.dt)
      backstage.SavePayRecordHelp(this, params)
    },
    // 删除
    deleteClick(row) {
      var multis = []
      var params = new URLSearchParams()
      if (row == undefined || row == '') {
        var arr = this.multipleSelection
        if (arr == undefined || arr.length <= 0) {
          this.$message({
            showClose: true,
            message: '请至少选中一行',
            type: 'error'
          })
          this.listLoading = false
          return
        } else {
          for (var i = 0; i < arr.length; i++) {
            multis.push(arr[i].id)
          }
          params.append('delds', JSON.stringify(multis))
        }
      } else {
        multis.push(row.id)
        params.append('delds', JSON.stringify(multis))
      }
      this.$confirm('确认删除吗？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'error'
      })
        .then((a) => {
          this.listLoading = true
          backstage.DelPayRecordHelp(this, params)
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          })
          this.listLoading = false
        })
    },
    // 查询
    fetchData() {
      this.listLoading = true
      var params = new URLSearchParams()
      params.append(
        'Parms',
        '{"page":' +
          this.listQuery.page +
          ',"rows":' +
          this.listQuery.limit +
          '}'
      )
      var user = JSON.parse(sessionStorage.getItem('userinfo'))
      params.append(
        'StDt',
        this.form.StDt == '' ? '' : this.form.StDt.toLocaleDateString()
      )
      params.append(
        'EdDt',
        this.form.EdDt == '' ? '' : this.form.EdDt.toLocaleDateString()
      )
      params.append('PayID', this.listQuery.title)
      params.append('CpnID', this.logincpnid)
      backstage.GetOthpayRecordLst(this, params)
    }
  }
}
// 后台事件
var backstage = {
  // 获取PayRecordHelp集合
  GetOthpayRecordLst: function(thisobj, params) {
    AjaxToken(
      thisobj,
      'GetOthpayRecordLst',
      params,
      'post',
      function(res) {
        thisobj.listLoading = false
        var body = res.data.data
        thisobj.PayRecordHelpData = body.rows
        thisobj.listQuery.page = body.page
        thisobj.listQuery.total = body.records
      },
      function(err) {}
    )
  },
  SavePayRecordHelp: function(thisobj, params) {
    AjaxToken(
      thisobj,
      'SavePayRecordHelp',
      params,
      'post',
      function(res) {
        var body = res.data
        if (body.success) {
          thisobj.$message({
            showClose: true,
            message: body.message,
            type: 'success',
            duration: 2000
          })
          thisobj.fetchData()
          thisobj.dialogFormVisible = false
        } else {
          thisobj.$message({
            showClose: true,
            message: body.message,
            type: 'error'
          })
        }
      },
      function(err) {}
    )
  },
  DelPayRecordHelp: function(thisobj, params) {
    AjaxToken(
      thisobj,
      'DelPayRecordHelp',
      params,
      'post',
      function(res) {
        thisobj.listLoading = false
        var body = res.data
        if (body.success) {
          thisobj.$message({
            showClose: true,
            message: body.message,
            type: 'success',
            duration: 2000
          })
          thisobj.fetchData()
          thisobj.dialogFormVisible = false
        } else {
          thisobj.$message({
            showClose: true,
            message: body.message,
            type: 'error'
          })
        }
      },
      function(err) {}
    )
  },
  GeCpntListItems: function(thisobj) {
    SelectAjax(
      'GeCpntListItems?val=' + thisobj.cpnid + '',
      function(response) {
        var body = response.data
        thisobj.cpnoptions = []
        body.data.forEach((element) => {
          thisobj.cpnoptions.push({
            value: element.value,
            label: element.text
          })
        })
      },
      function(error) {}
    )
  },
  GetPyChannelSelectListItems: function(thisobj, cpnid) {
    SelectAjax(
      'GetPyChannelSelectListItemsByCpnid?val=' + cpnid,
      function(response) {
        var body = response.data
        thisobj.paytychanneloptions = []
        body.data.forEach((element) => {
          thisobj.paytychanneloptions.push({
            value: element.value,
            label: element.text
          })
        })
      },
      function(error) {}
    )
  },
  GetCpnActListSelectListItems: function(thisobj, cpnid, paychannel) {
    SelectAjax(
      'GetCpnActList?cpnid=' + cpnid + '&paychannel=' + paychannel,
      function(response) {
        var body = response.data
        thisobj.actlist = []
        body.data.forEach((element) => {
          thisobj.actlist.push({
            value: element.value,
            label: element.text
          })
        })
      },
      function(error) {}
    )
  },
  beforeUpload: function(that, params) {
    AjaxUpload(
      that,
      'OtherPayUploadFile',
      params,
      'post',
      function(res) {
        that.exportloading = false
        that.$message({
          type: res.data.success ? 'success' : 'error',
          showClose: true,
          duration: 60000,
          message: res.data.message
        })
        if (res.data.success) {
          that.dialogExportVisible = false
        }
      },
      function(error) {
        that.exportloading = false
        that.$message({
          type: 'error',
          showClose: true,
          duration: 60000,
          message: '请求失败! error:' + error
        })
      }
    )
  }
}
</script>
<style lang="scss" scoped>
.red {
  color: red;
}
.green {
  color: green;
}
.el-form-item{
  width: 30%;
}
</style>
<style>
.exportotherpaydiv .el-form-item--medium .el-form-item__label {
  text-align: right;
  font-weight: 400;
  width: 100px;
}
.exportotherpaydiv .dialog-footer {
  text-align: right;
}
.el-dialog__title{
  font-size: 18px !important;
}

</style>
